package org.jfonia.musicxml.model;

import org.w3c.dom.Node;

/**
 * Value element specifying the type (eight, quarter, ...) and number of augmentation dots.
 * This convenience class doesn't correspond to an element in MusicXML - type and dots
 * are directly part of the note-element.
 * 
  * 
 * 
 * @author Wijnand
 *
 */
public class Value extends Element
{
	private String type;	// "whole", "half" etc.
	                        // null if not specified
	
//	private int	recip;		// reciprocal exponent (1:WHOLE, 2:HALF, 3:QUARTER, ...)
//							// numerical representation of 'type' ("quarter", ...)
	
	private int	numDots;	// number of augmentation dots

	public Value(Node node)
	{
		super(node);
	}
	
	public Value(Node node, String type, int numDots)
//	public Value(Node node, String type, int recip, int numDots)
	{
		super(node);
		this.type = type;
//		this.recip = recip;
		this.numDots = numDots;
	}


	public void setNumDots(int numDots)
	{
		this.numDots = numDots;
	}

	public int getNumDots()
	{
		return numDots;
	}

//	public void setRecip(int recip)
//	{
//		this.recip = recip;
//	}
//
//	public int getRecip()
//	{
//		return recip;
//	}
	
	public String toString()
	{
		StringBuffer sb = new StringBuffer();
		sb.append(type);
		for (int i=0; i<numDots; i++)
			sb.append(".");
		return sb.toString();
	}

	public String getType()
	{
		return type;
	}

	public void setType(String type)
	{
		this.type = type;
	}
}
